package com.jihui.jihuipicturebackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * @Description: 图片审核状态枚举
 * @author jihui
 * @date 2024/12/30 15:31
 */
@Getter
public enum PictureReviewStatusEnum {

    REVIEWING("待审核", 0),
    PASS("通过", 1),
    REJECT("拒绝", 2);

    private final String text;
    private final Integer value;

    PictureReviewStatusEnum(String text, Integer value) {
        this.value = value;
        this.text = text;
    }


    /**
     * 根据value获取PictureReviewStatusEnum
     * @param value
     * @return
     */
    public static PictureReviewStatusEnum getPictureReviewStatusEnum(Integer value) {
        if (ObjUtil.isEmpty(value)) {
            return null;
        }
        for (PictureReviewStatusEnum pictureReviewStatusEnum : PictureReviewStatusEnum.values()) {
            if (pictureReviewStatusEnum.getValue().equals(value)) {
                return pictureReviewStatusEnum;
            }
        }
        return null;
    }
}
